﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConjureBivouac2012.Object
{
    public abstract class AbstractPowerUp : Entity
    {
        protected int timeLife = 5;
        protected int timer = 0;

        public AbstractPowerUp()
        {
            base.Initialize();
            LoadContent(GameInfo.GetInstance().GetContent());
        }

        public abstract void ApplyEffect(Entity player);

        public override bool hasToBeDestroyed()
        {
            return (timeLife <= 0);
        }

        public override void destroyMe()
        {
            timeLife = 0;
        }

        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager contentManager)
        {
            base.LoadContent(contentManager);
            sprite.Depth = 0.8f;
        }

        public override void Update(Microsoft.Xna.Framework.GameTime time)
        {
            base.Update(time);
            if (time.TotalGameTime.Seconds - timer >= 1)
            {
                timer = time.TotalGameTime.Seconds;
                timeLife--;
            }
        }
    }
}
